<?php
require_once "db.php";

$cinema_name = db_escape($_POST['cinema_name']);
$address = db_escape($_POST['address']);
$logo = db_escape($_POST['logo']);

$exist_name="SELECT * FROM cinema WHERE cinema_name='$cinema_name'";
$match = db_query($exist_name);
$numRows = mysqli_num_rows($match);
if ($numRows!=0) {
	echo 'This cinema already exist in our database!';
}
else{
	$query = "INSERT INTO cinema (cinema_name, address, logo, active_or_not) VALUES ('$cinema_name', '$address', '$logo', 0)";
	$result = db_query($query);
	echo 'You have just added a new cinema, now add halls';
}

